﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataModel;
using System.Web.UI.HtmlControls;

public partial class Guest_Paper : System.Web.UI.Page
{
         protected void Page_Load(object sender, EventArgs e)
    {
        string control = @"<div id=""body"" dir=""rtl""><ul>";
        using (DefaultEntityConnection connection = new DefaultEntityConnection())
        {
            foreach (Paper paper in connection.Papers)
            {         
                control += string.Format(@"<li>
                                               <div class=""figure"">                                             
                                                    <span>{0}</span>
                                                    <img src=""{1}"" width=""200px"" height=""220px"" alt="""">
                                               </div>
				                               <div class=""article"">
                                                    <p> 
                                                        {2}                                                        
                                                        <a href=""{3}""/>                                                       
                                                    </p>                   
                                               </div>
                                           </li>", paper.PaperTitle, string.Format("../Images/Paper/{0}", paper.ImageUrl), paper.Description, string.Format("../Files/Paper/{0}", paper.FileUrl));
            }
        }
        control += @"</ul>
	                </div>";     
        if (control != string.Empty)
        {
            HtmlGenericControl div = new HtmlGenericControl();
            div.ID = "body1";
            div.InnerHtml = control;
            paperDiv.Controls.Add(div);
        }
    }
}